window.onload=function(){
    //获取地址id
    let url = window.location.href;
    let paramStr = url.split('?')[1]; 
    let paramArr= paramStr.split('&');
    let paramObj = {}; 
     for(let i=0;i<paramArr.length;i++){
         let p_item=paramArr[i];
          paramObj[p_item.split( '=')[0]]=p_item.split( '=')[1]
        } 
    //活动与属性
    $ajax({
        url:`https://elm.cangdu.org/shopping/restaurant/${paramObj.id}`,
        method:'get',
        async:true,
        success:(res)=>{
            console.log(res);
            for (let i = 0; i < res.supports.length; i++) {
                
                
                
                $create('kh_hdysx','kh_hdysxbody',
            `<div class='kh_hdysxdiv'>
            <span class='kh_hdysx1'>
            ${res.supports[i].icon_name}
            </span>
            <span class='kh_hdysx1-1'>${res.supports[i].description}</span>
            </div>
            `
            )
            }
            let kh_hdysx1=document.getElementsByClassName("kh_hdysx1")
                kh_hdysx1[1].style.backgroundColor="#57A9FF"
            $create('kh_foodjt','kh_hdysxbody',
            
            `<div class='kh_lh'><img src='/img/导航栏/良好.png'></div>
            <div class='kh_lh_text'>监督检查结果:<span class='kh_gree'>良好</span><br>
            检查日期:
            </div> `)
            $create('kh_sjxx','kh_sjxxbody',
            `<div class='kh_sjxxname'>${res.name}</div>
            <div class='kh_sjxxname'>地址：${res.address}</div>
            <div class='kh_sjxxname'>营业时间：[${res.opening_hours[0]}]</div>
            <div class='kh_sjxxname'>营业执照<span>></span></div>
            <div class='kh_sjxxname'>餐饮服务许可证<span>></span</div>
            `
            
            )
            
        }
    })



   
}